let UserInfo = sessionStorage.getItem('UserInfo')
UserInfo = UserInfo ? JSON.parse(UserInfo) : {}
const root = UserInfo.root
const auth = root ? {} : (UserInfo.auth || {})

export default [
  //首页管理 name-菜单名 key-绑定关键字 url-路由地址 son:[] 子菜单 格式一样
  {
    name: '首页管理', key: 'v-首页管理', son: [
      { name: 'banner管理-pc', key: 'v-bannarPc', url: '/bannarPc', son: [] },
      { name: '楼层管理-pc', key: 'v-floorPc', url: '/floorPc', son: [] },
      { name: '专区管理-pc', key: 'v-activityPc', url: '/activityPc', son: [] },
      { name: '推荐管理-pc', key: 'v-recommendPc', url: '/recommendPc', son: [] },
      { name: 'banner管理-app', key: 'v-bannarApp', url: '/bannarWx', son: [] },
      { name: '楼层管理-app', key: 'v-floorApp', url: '/floorWx', son: [] },
      { name: '推荐管理-app', key: 'v-recommendApp', url: '/recommendWx', son: [] },
      { name: '全局关键字管理', key: 'v-keyword', url: '/keyword', son: [] },
      { name: '推荐商品管理', key: 'v-PickWeek', url: '/PickWeek', son: [] },
      { name: 'seo标签管理', key: 'v-SeoLabel', url: '/SeoLabel', son: [] },
    ]
  },
  {
    name: '商品管理', key: 'v-商品管理', son: [
      { name: '商品信息库管理', key: 'v-goodsInfo', url: '/goodsInfo', son: [] },
      { name: '全部商品管理', key: 'v-allGoods', url: '/allGoods', son: [] },
      { name: '商品标签管理', key: 'v-goodsLabel', url: '/goodsLabel', son: [] },
      { name: '商品关联管理', key: 'v-goodsrelevance', url: '/goodsrelevance', son: [] },
      { name: '前端分类管理', key: 'v-FrontEnd', url: '/FrontEnd', son: [] },
      { name: '后端分类管理', key: 'v-BackEnd', url: '/BackEnd', son: [] },
      { name: '前后端分类对应管理', key: 'v-FrontAndBack', url: '/FrontAndBack', son: [] },
      { name: '品牌管理', key: 'v-brand', url: '/brand', son: [] },
    ]
  },
  // {
  //     name: '营销管理', key: 'v-营销管理', son: [
  //     { name: '广告管理', key: 'v-Advertising', url: '/Advertising', son: [] },
  //     { name: '专场管理', key: 'v-Special', url: '/Special', son: [] },
  //     { name: '活动管理', key: 'v-Activity', url: '/Activity', son: [] },
  //     { name: '导航管理', key: 'v-Navigation', url: '/Navigation', son: [] },
  //     { name: '消息管理', key: 'v-Message', url: '/Message', son: [] },
  //     { name: '推荐管理', key: 'v-Recommended', url: '/Recommended', son: [] },
  //     { name: '页面布局配置', key: 'v-Layoutd', url: '/Layoutd', son: [] },
  // ]
  // },
  {
    name: '订单管理', key: 'v-订单管理', son: [
      { name: '订单列表', key: 'v-orderlist', url: '/orderlist', son: [] },
      { name: '远程审单', key: 'v-inspection', url: '/inspection', son: [] },
      { name: '处方订单', key: 'v-prescription', url: '/prescription', son: [] },
      { name: '申请列表', key: 'v-applyOrderList', url: '/applyOrderList', son: [] },
      { name: '退款列表', key: 'v-refundOrderList', url: '/refundOrderList', son: [] },
    ]
  },
  {
    name: '会员管理', key: 'v-会员管理', son: [
      { name: '会员列表', key: 'v-viplist', url: '/viplist', son: [] },
    ]
  },
  {
    name: '系统设置', key: 'v-系统设置', son: [
      { name: '全局设置', key: 'v-setting', url: '/setting', son: [] },
      { name: '邮费设置', key: 'v-postage', url: '/postage', son: [] },
    ]
  },
  // {
  //     name: '直销管理', key: 'v-直销管理', son: [
  //     { name: '直销商品管理', key: 'v-crmGoods', url: '/crmGoods', son: [] },
  //     {
  //         name: '直销会员管理', key: 'v-crmUser', url: '', son: [
  //         { name: '会员列表', key: 'v-crmUserlist', url: '/crmUserlist', son: [] },
  //         { name: '新增会员', key: 'v-crmAddCrmUser', url: '/crmAddCrmUser', son: [] },
  //     ]
  //     },
  //     {
  //         name: '直销订单管理', key: 'v-crmOrder', son: [
  //         { name: '订单列表', key: 'v-crmOrderlist', url: '/crmOrderlist', son: [] },
  //         { name: '新建订单', key: 'v-crmSetOrder', url: '/crmSetOrder', son: [] },
  //         { name: '发货列表', key: 'v-crmSendList', url: '/crmSendList', son: [] },
  //     ]
  //     },
  //     {
  //         name: '直销系统设置', key: 'v-crmSetting', son: [
  //         { name: '客户来源设置', key: 'v-crmGuestChannel', url: '/crmGuestChannel', son: [] },
  //         { name: '白名单设置', key: 'v-crmWhitelist', url: '/crmWhitelist', son: [] },
  //         { name: '订金支付类型设置', key: 'v-crmDeposit', url: '/crmDeposit', son: [] },
  //     ]
  //     },
  //     {
  //         name: '统计分析', key: 'v-statistics', url: '/vipuser', son: [
  //         { name: '业绩统计', key: 'v-achievement', url: '/achievement', son: [] },
  //         { name: '商品销售统计', key: 'v-productSales', url: '/productSales', son: [] },
  //         { name: '快递分类统计', key: 'v-expressClassify', url: '/expressClassify', son: [] },
  //     ]
  //     },
  // ]
  // },
  {
    name: '权限管理', key: 'v-权限管理', son: [
      { name: '权限设置', key: 'v-authority', url: '/authority', son: [] },
      { name: '部门管理', key: 'v-department', url: '/department', son: [] },
      { name: '角色管理', key: 'v-roles', url: '/roles', son: [] },
      { name: '员工管理', key: 'v-user', url: '/user', son: [] },
    ]
  },
  {
    name: '橘色小工具', key: 'v-橘色小工具', son: [
      {
        name: '我的申请', key: 'v-applyList', son: [
          { name: '费用申请', key: 'v-myApplyList', url: '/myApplyList', son: [] },
          { name: '退费申请', key: 'v-refundList', url: '/refundList', son: [] },
        ]
      },
      {
        name: '待审中心', key: 'v-beforeApproveCenter', son: [
          { name: '费用待审', key: 'v-beforeApproveList', url: '/beforeApproveList', son: [] },
          { name: '退费待审', key: 'v-ChannelListBeforeApprove', url: '/channelListBeforeApprove', son: [] },
        ]
      },
      {
        name: '已审中心', key: 'v-afterApproveCenter', son: [
          { name: '费用审批', key: 'v-afterApproveList', url: '/afterApproveList', son: [] },
          { name: '退费审批', key: 'v-channelListAfterApprove', url: '/channelListAfterApprove', son: [] },
        ]
      },
      {
        name: '资料管理', key: 'v-fileManagement', son: [
          { name: '资料列表', key: 'v-fileManage', url: '/fileManage', son: [] },
        ]
      },
      {
        name: '数据管理', key: 'v-channelManagement', son: [
          { name: '数据列表', key: 'v-channelList', url: '/channelList', son: [] },
        ]
      },
      {
        name: '预算管理', key: 'v-budgetManagement', son: [
          { name: '预算管理', key: 'v-budgetManage', url: '/budgetManage', son: [] },
          { name: '每日预算', key: 'v-everydayBudget', url: '/everydayBudget', son: [] },
        ]
      },
    ]
  },
  {
    name: '换号小工具', key: 'v-换号小工具', son: [
      {
        name: '换号管理', key: 'v-changeNumberManage', son: [
          { name: '换号管理界面', key: 'v-changeNumberInterface', url: '/changeNumberInterface', son: [] },
        ]
      },
    ]
  },
  {
    name: '微信管理', key: 'v-微信管理', son: [
      {
        name: '脂玫乐小程序', key: 'v-xcx', son: [
          { name: '用户管理', key: 'v-userManage', url: '/userManage', son: [], },
          { name: '活动管理', key: 'v-activityManage', url: '/activityManage', son: [] },
          { name: '海报图管理', key: 'v-poster', url: '/poster', son: [] }
        ]
      }
    ]
  },
  {
    name: '健康调养', key: 'v-健康调养', son: [
      { name: '类目管理', key: 'v-categoryManage', url: '/categoryManage', son: [] },
      { name: '病症管理', key: 'v-diseaseManage', url: '/diseaseManage', son: [] },
      { name: '调养管理', key: 'v-nurseManage', url: '/nurseManage', son: [] }
    ]
  },
  {
    name: '官网管理', key: 'v-官网管理', son: [
      {
        name: '谷方益元', key: 'v-gufangyiyuan', son: [
          { name: '新闻管理', key: 'v-news-gfyy', url: '/informationList_gfyy', son: [] },
          { name: '产品编辑', key: 'v-product-gfyy', url: '/merchandiseList_gfyy', son: [] },
          { name: '咨询顾问', key: 'v-consultant-gfyy', url: '/consultant_gfyy', son: [] },
          //{ name: '热卖产品', key:'v-hot-product-gfyy',url:'/hot_product_gfyy',son: [] }
        ]
      },
      {
        name: '谷医堂', key: 'v-guyitang', son: [
          { name: '新闻管理', key: 'v-news-gyt', url: '/informationList_gyt', son: [] },
        ]
      },
      {
        name: '脂玫乐', key: 'v-zhimeile', son: [
          { name: '产品编辑', key: 'v-product_zml', url: '/merchandiseList_zml', son: [] },
          { name: '咨询顾问', key: 'v-consultant-zml', url: '/consultant_zml', son: [] },
          { name: '新闻管理', key: 'v-news_zml', url: '/informationList_zml', son: [] },
          { name: '案例编辑', key: 'v-caseEdit_zml', url: '/caseedit_zml', son: [] },
        ]
      },
    ]
  },
  {
    name: '在线问诊', key: '在线问诊', son: [
      { name: '问诊订单', key: 'v-onlineInquiry', url: '/onlineInquiry', son: [] },
    ]
  },
  {
    name: '支付中心', key: '支付中心', son: [
      { name: '支付订单', key: 'v-paymentOrder', url: '/paymentOrder', son: [] },
      { name: '提现申请', key: 'v-applicationCash', url: '/applicationCash', son: [] },
    ]
  },
  {
     name: '综合平台', key: 'v-综合平台', son: [
      { name: 'banner管理', key: 'v-platformBanner', url: '/platformBanner', son: [] },
      { name: '首页名医在线', key: 'v-indexDoctor', url: '/indexDoctor', son: [] },
      { name: '首页明星产品', key: 'v-indexGoods', url: '/indexGoods', son: [] },
    ]
  },
  {
     name: '运营用户管理', key: 'v-运营用户管理', son: [
      { name: '用户管理', key: 'v-businessBackUserManage', url: '/businessBackUserManage', son: [] },
      { name: '医生管理', key: 'v-businessBackDoctorManage', url: '/businessBackDoctorManage', son: [] },
    ]
  },

].map(value => {
  if (root || auth[value.name]) {
    const serverAuth = auth[value.name]
    if (root || serverAuth[value.key]) {
      function loop(value) {
        const son = value.son
        if (son && son.length) {
          son.map((item, index) => {
            if (!(root || serverAuth[item.key])) {
              son[index] = undefined
            } else if (item.son && item.son.length) {
              loop(item)
            }
          })
        }
      }
      loop(value)
      return value
    }
  }
  return
})